<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .btn{
            display:inline-block;
            line-height:1;
            white-space:nowrap;
            cursor:pointer;
            color:#ecf5ff;
            background:#b3d8ff;
            text-align:#b3d8ff;
            text-align:center;
            box-sizing:border-box;
            padding:12px 20px;
            font-size:14px;
            border-radius: 4px;
        }
    </style>
    <script src="/js/vue.js"></script>
</head>
<body>
    <div id="app">
        <counter inline-template>
            <button @click="num++">点击{{num}}次</button>
        </counter>
        <counter inline-template>
            <span class="btn"@click="num++">计数{{num}}次</span>
        </counter>
    </div>
    <script>
        //当组件上有一个特殊的属性inline-template时,
        //组件会将其内部当成组件模板,此时在定义该组件时,
        //可以没有template属性
        Vue.component('counter',{
            data:function(){
                return{
                    num:0
                }
                    
            },
            template:'<button @click="num++">点击{{num}}次</button>'
        })
        let vm = new Vue({
            el:'#app'
            
        })
    </script>
</body>
</html>